# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Contributor: Sandro Jäckel <sandro.jaeckel@posteo.de>
# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Carlo Landmeter <clandmeter@alpinelinux.org>
pkgname=wget2
pkgver=2.0.0
pkgrel=1
pkgdesc="Network utility to retrieve files from the Web"
url="https://www.gnu.org/software/wget/wget.html"
arch="all"
license="GPL-3.0-or-later WITH OpenSSL-Exception"
makedepends="
	brotli-dev
	bzip2-dev
	doxygen
	graphviz
	libidn2-dev
	lzlib-dev
	texinfo
	nghttp2-dev
	openssl-dev
	pcre2-dev
	zlib-dev
	zstd-dev
	xz-dev
	"
checkdepends="libmicrohttpd-dev"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-libs"
source="https://ftp.gnu.org/gnu/wget/wget2-$pkgver.tar.gz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-libidn \
		--with-ssl=openssl \
		--without-libpsl \
		--without-libhsts \
		--without-gpgme \
		--enable-fuzzing \
		--disable-manylibs \
		--disable-nls \
		--disable-rpath
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -f "$pkgdir/usr/bin/wget2_noinstall"
	install -Dm644 docs/man/man1/wget2.1 -t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
59be98a43057220f4eb4314d0876990c21bbc2606a82444e03282ca55d6de18a382fb75b3fcbb1e7f5a5930cd9a81c6c73cdac2ffba3932b55816fb8140c00eb  wget2-2.0.0.tar.gz
"
